﻿using System.Runtime.InteropServices;

namespace CommunServer.Model
{
    [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]
    public struct PakLoginReq
    {
        /// <summary>
        /// 消息类型（1.注册、2.登陆、3、翻译、4、历史查询）
        /// </summary>
        public char MesType;
        /// <summary>
        /// 通讯类型 1接收 或 2返回
        /// </summary>
        public char CommType;
        /// <summary>
        /// 用户名字
        /// </summary>
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string UserName;
        /// <summary>
        /// 域4；用户密码
        /// </summary>
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string PWD;
        /// <summary>
        /// 发送日期  YYYYMMDD
        /// </summary>
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
        public string SenData;
        /// <summary>
        /// 发送时间hhmmss
        /// </summary>
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 6)]
        public string SenTime;
        /// <summary>
        /// Max校验位
        /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
        public char[] MAC;

    }

    [StructLayoutAttribute(LayoutKind.Sequential, CharSet = CharSet.Ansi, Pack = 1)]

    public struct Base
    {
        /// <summary>
        /// 消息类型（1.注册、2.登陆、3、翻译、4、历史查询）
        /// </summary>
        public char MesType;
        /// <summary>
        /// 通讯类型 1接收 或 2返回
        /// </summary>
        public char CommType;
    }
    public struct LoginReq
    {
        public Base Base;
        /// <summary>
        /// 用户名字
        /// </summary>
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string UserName;
        /// <summary>
        /// 域4；用户密码
        /// </summary>
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 10)]
        public string Pwd;
        /// <summary>
        /// 发送日期  YYYYMMDD
        /// </summary>
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 8)]
        public string SenData;
        /// <summary>
        /// 发送时间hhmmss
        /// </summary>
        [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 6)]
        public string SenTime;
        /// <summary>
        /// Max校验位
        /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
        public char[] Mac;

    }


    public struct DataModel
    {  /// <summary>
       /// Max校验位
       /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
        public char[] Name;
        /// <summary>
        /// Max校验位
        /// </summary>
        [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)]
        public char[] Connect;
    }

    public struct CommData
    {
        public Base Base;
        
        public DataModel[] Data;

    }
    ////登陆注册请求 
    //typedef struct Pak_Login_req
    //{

    //    char MesType;//消息类型（1.注册、2.登陆、3、翻译、4、历史查询） 
    //    char CommType;//通讯类型 1接收 或 2返回   
    //    char UserName[10];//用户名字 
    //    char PWD[10];//域4；用户密码  
    //    char SenData[8];//发送日期  YYYYMMDD 
    //    char SenTime[6];//发送时间hhmmss 
    //    char MAC[8];//Max校验位 
    //}
    //Login_req;




}
